module.exports = function (sequelize, DataTypes) {
    const Bike = sequelize.define(
        'bike',
        {
            name: {
                type: DataTypes.STRING,
                allowNull: false,
                comment: '名字'
            },
            marketTime: {
                type: DataTypes.STRING,
                allowNull: false,
                comment: '上市时间'
            },
            brandId: {
                type: DataTypes.INTEGER,
                allowNull: false,
                comment: '品牌Id'
            },
            brandName: {
                type: DataTypes.STRING,
                allowNull: false,
                comment: '品牌名称'
            },
            img: {
                type: DataTypes.STRING,
                allowNull: false,
                comment: '图片'
            },
            detailParams: {
                type: DataTypes.TEXT('long'),
                allowNull: false,
                comment: '车子配件详细参数'
            },

            price: {
                type: DataTypes.INTEGER,
                allowNull: false,
                comment: '价格'
            },
            bikeType: {
                type: DataTypes.STRING,
                allowNull: false,
                comment: '类型(山地车，公路车)'
            },
            bikeTags: {
                type: DataTypes.STRING,
                comment: '单车标签，比如碳纤维车架等等等'
            },
            status: {
                type: DataTypes.BOOLEAN,
                defaultValue: true,
                comment: '是否上架'
            },
            score:{
                type: DataTypes.DECIMAL(3,1),
                comment: '综合评分'
            },
            isScored:{
                type: DataTypes.BOOLEAN,
                defaultValue: false,
                comment: '综合评分'
            },
            createdByUserId: {
                type: DataTypes.STRING,
                allowNull: false,
                comment: '创建人Id'
            }
        },
        {
            timestamps: true, //createAt updateAt是否显示
            createdAt: 'createdTime', // 将createdAt设为自定义字段createdTime
            updatedAt: 'updatedTime',
            deletedAt: 'deletedTime',
            paranoid: true
        }
    )
    return Bike
}

